﻿using EAS.Common.Configs;
using Terraria;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;

namespace EAS.Common.AccessorySlot
{
    public class MusicBoxSlot : ModAccessorySlot
    {
        public override bool CanAcceptItem(Item checkItem, AccessorySlotType context) => checkItem.Name.Contains(EAS.English ? "Music Box" : "八音盒");
        public override bool ModifyDefaultSwapSlot(Item item, int accSlotToSwapTo) => CanAcceptItem(item, (AccessorySlotType)10);
        public override bool IsEnabled()
        {
            if (ModContent.GetInstance<MyConfig>().MusicBox)
            {
                return true;
            }
            return false;
        }

        public override bool IsVisibleWhenNotEnabled() => false;

        public override string FunctionalTexture => "Terraria/Images/Item_" + ItemID.MusicBox;

        public override void OnMouseHover(AccessorySlotType context)
        {

            switch (context)
            {
                case AccessorySlotType.FunctionalSlot:
                case AccessorySlotType.VanitySlot:
                    Main.hoverItemName = Language.GetTextValue("Mods.EAS.Message.11");
                    break;
                case AccessorySlotType.DyeSlot:
                    Main.hoverItemName = Language.GetTextValue("Mods.EAS.Message.4");
                    break;
            }
        }
    }
}
